package pen_exam.xiaomi_2024_03_23;

import java.util.Scanner;

public class Class01_ChoosePeo {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int k = Integer.parseInt(str[1]);
        int a = Integer.parseInt(str[2]);
        int b = Integer.parseInt(str[3]);
        String[] str1 = sc.nextLine().split(" ");
        String[] str2 = sc.nextLine().split(" ");
        int[] abl = new int[n];
        int[] hez = new int[n];
        for (int i = 0; i < n; i++) {
            abl[i] = Integer.parseInt(str1[i]);
            hez[i] = Integer.parseInt(str2[i]);
        }
        System.out.println(func(abl, hez, a, b, k));
        ;
    }

    public static int func(int[] abl, int[] hez, int a, int b, int k) {
        int ans = 0;
        int Acan = 0;
        int Bcan = 0;
        for (int i = 0; i < abl.length; i++) {
            if (i < k) {
                if (abl[i] >= a) {
                    Acan++;
                }
                if (hez[i] >= b) {
                    Bcan++;
                }
                continue;
            }
            //结算 左扩
            if (Acan == k && Bcan == k) {
                ans++;
            }
            if (abl[i - k] >= a) {
                Acan--;
            }
            if (hez[i - k] >= b) {
                Bcan--;
            }
            if (abl[i] >= a) {
                Acan++;
            }
            if(hez[i] >= b){
                Bcan++;
            }
        }
        if (Acan == k && Bcan == k) {
            ans++;
        }
        return ans;
    }
}
